package net.towee.server.authentication;

import java.util.Date;

import net.towee.server.persistence.impl.MongoDbStore;
import net.towee.server.util.RandomBase64Generator;

import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Id;

/**
 * Entity for storing email confirm data 
 * @author c58
 */
@Entity(MongoDbStore.EMAIL_CONFIRM_COLLECTION)
public class ConfirmEntry {
	// Unique string
	@Id private String confirm;
	
	// Account id of this confirm 
	private String accountId;
	private String email;
	
	// Date of creation for removing expired (after 10 days)
	private Date creationDate;
	
	public ConfirmEntry() {}
	public ConfirmEntry(String accId, String email) {
		this.confirm   = new RandomBase64Generator().next(64);
		this.accountId = accId;
		this.email = email;
		this.creationDate = new Date();
	}
	
	public String getConfirm() {
		return confirm;
	}
	
	public String getAccountId() {
		return accountId;
	}
	
	public void setAccountId(String id) {
		this.accountId = id;
	}
	public String getEmail() {
		return email;
	}
}
